import 'package:ducafe_ui_core/ducafe_ui_core.dart';
import 'package:flutter/material.dart';
import 'package:flutter_mes_app/common/index.dart';
import 'package:flutter_mes_app/main.dart';
import 'package:get/get.dart';

import 'index.dart';

class StepperPage extends GetView<StepperController> {
  const StepperPage({super.key});

  // 主视图
  Widget _buildView() {
    return <Widget>[
      const TextWidget.h4("large"),
      const StepperWidget(
        value: 0,
        min: 0,
        max: 9999999,
        scale: WidgetScale.large,
        disabled: false,
      ),
      const TextWidget.h4("medium"),
      const StepperWidget(
        value: 0,
        min: -20,
        max: 9999999,
        scale: WidgetScale.medium,
        disabled: false,
      ),
      const TextWidget.h4("small"),
      const StepperWidget(
        value: 0,
        min: 0,
        max: 9999999,
        scale: WidgetScale.small,
        disabled: false,
      ),
      const TextWidget.h4("input宽度"),
      const StepperWidget(
        value: 0,
        min: -20,
        step: 2,
        inputWidth: 200,
        max: 9999999,
        scale: WidgetScale.medium,
        disabled: false,
      ),
      const StepperWidget(
        value: 0,
        min: -20,
        step: 2,
        inputWidth: 200,
        max: 9999999,
        scale: WidgetScale.medium,
        disabled: true,
      ).paddingTop(20),
    ].toColumnSpace();
  }

  @override
  Widget build(BuildContext context) {
    return GetBuilder<StepperController>(
      init: StepperController(),
      id: "stepper",
      builder: (_) {
        return Scaffold(
          appBar: AppBar(title: const Text("stepper")),
          body: SafeArea(
            child: _buildView(),
          ),
        );
      },
    );
  }
}
